import gtk
from xmmsclient.collections import *


class MlibModel:
    artistfilter = None
    
    def __init__(self, mlibview, builder):
        titlecol = TreeViewColumn("Title", CellRendererText(), text=0)
        artistcol = TreeViewColumn("Artist", CellRendererText(), text=1)
        albumcol = TreeViewColumn("Album", CellRendererText(), text=2)
        treeview = builder.get_object("detailedinfoview")
        treeview.append_column(titlecol)
        treeview.append_column(albumcol)
        treeview.append_column(artistcol)
        self.store = builder.get_object("detaildeinfo")
        self.xmms2 = mlibview.xmms2
        self.xmms2.coll_query_infos(
            Universe(), 
            ["artist", "album"],
            cb=self.add_to_store)
        
    def add_to_store(self, res):
        if res.iserror():
            print "error"
            return
        info = res.value()
        print info

